home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: judgemi@ix.netcom.com(Michael Judge )
- Newsgroups: comp.lang.c++
- Subject: Re: Global Variables
- Date: 9 Feb 1996 04:48:36 GMT
- Organization: Netcom
- Message-ID: <4fejn4$jt8@reader2.ix.netcom.com>
- References: <4fefb3$dhf@tofu.alt.net>
- NNTP-Posting-Host: ix-bst-ma1-22.ix.netcom.com
- X-NETCOM-Date: Thu Feb 08 8:48:36 PM PST 1996
-
- In <4fefb3$dhf@tofu.alt.net> Larry Buller <ljbuller@mail.btigate.com>
- writes:
- >
- >Help!!! I'm using visualc++ 4.0. What I want to do is recall
- information
- >from an ini file... I already know how to do that. What I can't seem
- to
- >figure out is how to reference global variables in other classes. For
-
- >instance I can declare a variable outside of functions and class and
- That
- >is supposed to make it global. If I delcare x in 1.h and define it in
-
- >1.cpp then try to refer to x in 2.cpp I get an undeclared variable
- error.
- >If I make sure the declaration also exists in the 2.h, then I get a
- linker
- >error. I know this has got to be a real simple answer, but I'll be
- darned
- >if I can find the answer. Any body got help for this soul lost in c++
-
- >hell? Larry Buller
- >
-
- I believe what you want to do is have a common ".h" file like
- ---------------------
- //this is the l.h file
-
-
- class declarations
- {.
-